package com.googlecode.loframework.model
{
	import com.googlecode.loframework.data.QuizzesVO;
	
	import flash.utils.Dictionary;
	
	import mx.core.UIComponent;
	
	import org.puremvc.as3.patterns.proxy.Proxy;

	public class QuizProxy extends Proxy
	{
		
		/**
		 * PureMVC identifier 
		 */		
		public static const NAME:String = "QuizProxy";
		
		/**
		 * Constructor 
		 * 
		 */
		public function QuizProxy()
		{
			super(NAME, new QuizzesVO());
		}
		
		/**
		 * Each question component is stored in a dictionary so that it can easily be referenced
		 * to a value or VO.
		 *  
		 * @param component
		 * @param value
		 * 
		 */
		public function setQuestion(component:UIComponent, value:*):void
		{
			settings.questions[component] = value;
		}
		
		/**
		 * Returns the dictionary containing references to question components and their associated values. 
		 * @return 
		 * 
		 */
		public function get questionList():Dictionary
		{
			return settings.questions;
		}
		
		/**
		 * Quizzes may have a number of possible outcomes. Personality quizzes, for example, 
		 * are based on matching question answers with a matrix of possible answers. Because there
		 * are potentially many ways in which quizzes may be evaluated, outcomes are regarded as flexibly
		 * as possible. They are linked to their associated question set by using a name common to both
		 * the questions and the OutcomesVO value object. 
		 * 
		 */
		/* public function addQuizOutcome(outcome:OutcomeVO):void
		{
			settings.outcomes.push(outcome);
		} */
		
		/**
		 * Returns a typed reference to QuizzesVO. 
		 * @return 
		 * 
		 */
		protected function get settings():QuizzesVO
		{
			return data as QuizzesVO;
		}
	}
}